<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Title</title>
</head>
<body>
<script>
  class Animal {
    category
    voice

    constructor(category, voice) {
      this.category = category
      this.voice = voice
    }

    description() {
      console.log('我是', this.category, ',我会', this.voice)
    }
  }

  class Dog extends Animal {
    constructor(category, voice) {
      super(category, voice)
    }

    eat() {
      console.log('吃骨头')
    }
  }

  const dog = new Dog('dog', 'wang wang wang~')
  dog.description()
  dog.eat()
</script>
</body>
</html>